package chapter01;

public class Test19_Method {
    public static void main(String[] args) {
        int n1 = 10;
        int n2 = 20;
        int n3 = add(n1,n2);
        System.out.println(n3);
        multi();
        //定义一个除法 调用方法
        System.out.println(div(n1,n2));
    }
    public static int add(int a,int b){
        int c = a+b;
        return c;
    }
    public static void multi(){
        for(int i=1;i<=9;i++){
            for(int j=1;j<=i;j++){
                System.out.print(i+"*"+j+"="+(i*j)+"\t");
            }
            System.out.println();
        }
    }
    public static int div(int a,int b){
        if(b==0){
            System.out.println("除数不能为0");
            return 0;
        }
        return a/b;
    }
}
